<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="教师类型" prop="teacherTypes">
        <el-select filterable v-model="queryParams.teacherTypes" placeholder="请选择教师类型" clearable size="small" multiple>
          <el-option v-for="dict in teacherTypes" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="教师标签" prop="teacherTags">
        <el-select filterable v-model="queryParams.teacherTags" placeholder="请选择教师标签" clearable size="small" multiple>
          <el-option v-for="dict in teacherTags" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="教师名称" prop="teacherName">
        <el-input
          v-model="queryParams.teacherName"
          placeholder="请输入教师名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="教师简介" prop="teacherIntroduction">
        <el-input
          v-model="queryParams.teacherIntroduction"
          placeholder="请输入教师简介"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:teacher:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:teacher:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:teacher:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:teacher:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="teacherList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="排序号" align="center" prop="orderNum" sortable="custom" width="90"/>
      <el-table-column label="教师头像" align="center" prop="teacherHeadimgurl" width="170">
        <template slot-scope="scope">
          <imageUpload v-model="scope.row.teacherHeadimgurl" :table="scope.row.id+':'+'teacher'+':'+'pic'"/>          
        </template>
      </el-table-column>
      <el-table-column label="教师名称" align="center" prop="teacherName" width="300">
        <template slot-scope="scope">
          <p v-if="containsKeyword(scope.row.teacherName,'句块')"><a href="#" style="color:#1890ff;font-size:16px" @click="showJK(scope.row.teacherName,scope.row.id)">{{ scope.row.teacherName }}</a></p>
          <p v-else>{{ scope.row.teacherName }}</p>
        </template>
      </el-table-column>
      <el-table-column label="教师类型" align="center" prop="teacherType" width="100" :formatter="getTeacherType"/>
      <el-table-column label="教师标签" align="center" prop="teacherType" width="100" :formatter="getTeacherTag"/>
      <el-table-column label="教师简介" align="center" prop="teacherIntroduction">
        <template slot-scope="scope">
          <p style="width:100%;height:200px;overflow:hidden;" v-html='scope.row.teacherIntroduction'></p>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:teacher:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:teacher:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改课程教师对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="教师名称" prop="teacherName">
              <el-input v-model="form.teacherName" placeholder="请输入教师名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="教师类型" prop="teacherTypes">
              <el-select v-model="form.teacherTypes" placeholder="请选择教师类型" clearable style="width:100%;" multiple>
                <el-option v-for="dict in teacherTypes" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="教师类型" prop="teacherTags">
              <el-select v-model="form.teacherTags" placeholder="请选择教师标签" clearable style="width:100%;" multiple>
                <el-option v-for="dict in teacherTags" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="排序号" prop="orderNum">
              <el-input v-model="form.orderNum" placeholder="请输入排序号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="教师简介" prop="teacherIntroduction">
              <editor v-model="form.teacherIntroduction" :min-height="192"/>
            </el-form-item>
          </el-col>
        </el-row>        
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="titleJK" :visible.sync="openJK" width="1000px" append-to-body>
      <div class="sketch_content">
        <ul>
          <el-button icon="el-icon-upload2" size="mini" @click="handleImport">导入</el-button>
          <el-button icon="el-icon-plus" size="mini" @click="handleAddJK">新增</el-button>
          <el-button icon="el-icon-document" size="mini" @click="cancelJK">取消</el-button>
          <el-table v-loading="loadingJK" :data="jkList" @sort-change="sortJKChange">
            <el-table-column label="版本" align="left" prop="version" width="120px" sortable="custom"/>
            <el-table-column label="收费金额" align="right" prop="amount" width="100px" sortable="custom">
              <template slot-scope="scope">
                {{scope.row.isFree==1?'免费':'￥'+scope.row.amount}}
              </template>
            </el-table-column>
            <el-table-column label="句块内容" align="left" prop="materialName" sortable="custom"/>
            <el-table-column label="句块关键字" align="left" prop="materialKey" width="120" sortable="custom"/>            
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdateJKD(scope.row)"
                  v-hasPermi="['system:info:edit']"
                >修改</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDeleteJKD(scope.row)"
                  v-hasPermi="['system:info:remove']"
                >删除</el-button>                
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="totalJK>0"
            :total="totalJK"
            :page.sync="queryParamsJK.pageNum"
            :limit.sync="queryParamsJK.pageSize"
            @pagination="getListJK"
          />
          <el-dialog :title="titleJKD" :visible.sync="openJKD" width="800px" append-to-body>
            <el-form ref="form" :model="formJKD" :rules="rulesJKD" label-width="100px">
              <el-row>
                <el-col :span="24">
                  <el-form-item label="句块内容" prop="materialName">
                    <el-input v-model="formJKD.materialName" placeholder="请输入句块内容" />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>                
                <el-col :span="12">
                  <el-form-item label="句块关键字" prop="materialKey">
                    <el-input v-model="formJKD.materialKey" placeholder="请输入句块关键字" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="版本" prop="version">
                    <el-input v-model="formJKD.version" placeholder="请输入版本" />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="所属年级" prop="grade">
                    <el-select filterable v-model="formJKD.grade" placeholder="请选择所属年级" clearable style="width:100%;">
                      <el-option v-for="dict in grades" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="所属科目" prop="subject">
                    <el-select filterable v-model="formJKD.subject" placeholder="请选择所属科目" clearable style="width:100%;">
                      <el-option v-for="dict in subjects" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="所属年份" prop="age">
                    <el-input v-model="formJKD.age" placeholder="请输入所属年份" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="所属学期" prop="semester">
                    <el-select v-model="formJKD.semester" placeholder="请选择所属学期" clearable style="width:100%;">
                      <el-option v-for="dict in semesters" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="所属地域" prop="region">
                    <el-input v-model="formJKD.region" placeholder="请输入所属地域" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="是否免费" prop="isFree">
                    <el-select v-model="formJKD.isFree" placeholder="请选择是否免费" clearable style="width:100%;">
                      <el-option v-for="dict in yesNo" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="收费金额" prop="amount">
                    <el-input v-model="formJKD.amount" placeholder="请输入收费金额" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="分销折扣" prop="discount">
                    <el-input v-model="formJKD.discount" placeholder="请输入分销折扣" />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>                
                <el-col :span="12">
                  <el-form-item label="梯度比率" prop="discountBl">
                    <el-input v-model="formJKD.discountBl" placeholder="请输入梯度比率" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="上传用户" prop="userId">
                    <el-select filterable v-model="formJKD.userId" placeholder="请选择上传用户" clearable style="width:100%;">
                      <el-option v-for="dict in userList" :key="dict.userId" :label="dict.userName+':'+dict.phonenumber" :value="dict.userId"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button type="primary" @click="submitFormJKD">确 定</el-button>
              <el-button @click="cancelJKD">取 消</el-button>
            </div>
          </el-dialog>
          <el-dialog :title="upload.title" :visible.sync="upload.open" width="450px" append-to-body>      
            <el-upload
              ref="upload"
              :limit="1"
              accept=".xlsx, .xls"
              :headers="upload.headers"
              :action="upload.url + '?updateSupport='+upload.updateSupport"
              :disabled="upload.isUploading"
              :on-progress="handleFileUploadProgress"
              :on-success="handleFileSuccess"
              :auto-upload="false"
              drag
            >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                将文件拖到此处，或
                <em>点击上传</em>
              </div>
              <div class="el-upload__tip" slot="tip">
                <el-checkbox v-model="upload.updateSupport" @change="changeUpdateSupport"/>是否更新已经存在的句块
                <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
              </div>
              <div class="el-upload__tip" style="color:red" slot="tip">提示：仅允许导入“xls”或“xlsx”格式文件！</div>
            </el-upload>
            <div slot="footer" class="dialog-footer">
              <el-button type="primary" @click="submitFileForm">确 定</el-button>
              <el-button @click="upload.open = false">取 消</el-button>
            </div>
          </el-dialog>
        </ul>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listTeacher, getTeacher, delTeacher, addTeacher, updateTeacher, exportTeacher } from "@/api/business/teacher";
import { listInfojk, getInfojk, delInfojk, addInfojk, updateInfojk } from "@/api/business/infojk";
import { listUser } from "@/api/system/user";
import Editor from '@/components/Editor';
import ImageUpload from '@/components/ImageUpload';
import { getToken } from "@/utils/auth";
import { downLoadZip } from "@/utils/zipdownload";
export default {
  name: "Teacher",
  components: {
    Editor,
    ImageUpload
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      loadingJK: true,      
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      totalJK: 0,
      // 课程教师表格数据
      teacherList: [],
      // 弹出层标题
      title: "",
      titleJK: "",
      titleJKD: "",
      // 是否显示弹出层
      open: false,
      openJK: false,
      openJKD: false,
      grades: [],
      subjects: [],
      semesters: [],
      yesNo: [],
      userList: [],
      teacherTypes: [],
      teacherTags: [],
      jkList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        teacherName: null,
        teacherIntroduction: null,
        teacherHeadimgurl: null,
        teacherTypes: null,
        teacherTags: null
      },
      queryParamsJK: {
        pageNum: 1,
        pageSize: 10,
        version: null
      },
      // 表单参数
      form: {},
      formJKD: {},
      formUpload: {},
      upload: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的学生成绩数据
        updateSupport: false,        
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/infojk/importData"
      },
      // 表单校验
      rules: {
        teacherName: [
          { required: true, message: "教师名称不能为空", trigger: "blur" }
        ],
        teacherIntroduction: [
          { required: true, message: "教师简介不能为空", trigger: "blur" }
        ]
      },
      rulesJKD: {
        materialName: [
          { required: true, message: "句块内容不能为空", trigger: "blur" }
        ],
        materialKey: [
          { required: true, message: "句块关键字不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getDicts('teacher_type').then(response => {
      this.teacherTypes = response.data;
    });
    this.getDicts('teacher_tag').then(response => {
      this.teacherTags = response.data;
    });
    this.getDicts('grade').then(response => {
      this.grades = response.data;
    });
    this.getDicts('subject').then(response => {
      this.subjects = [];
      response.data.forEach(item => {
        if (item.dictLabel==='英语') {
          this.subjects.push(item);
        }
      })
    });
    this.getDicts('semester').then(response => {
      this.semesters = response.data;
    });    
    this.getDicts('yes_no').then(response => {
      response.data.forEach(item => {
        this.yesNo.push(item);
      })
    });
    listUser().then(response => {
      this.userList = response.rows;
    });
  },
  methods: {
    getTeacherType(row) {      
      let showtype = '';
      for (let i in this.teacherTypes) {
        if (row.teacherType&&row.teacherType.indexOf(this.teacherTypes[i].dictValue)>=0) {
          showtype = showtype + this.teacherTypes[i].dictLabel+',';
        }
      }
      return showtype;
    },
    getTeacherTag(row) {      
      let showtag = '';
      for (let i in this.teacherTags) {
        if (row.teacherTag&&row.teacherTag.indexOf(this.teacherTags[i].dictValue)>=0) {
          showtag = showtag + this.teacherTags[i].dictLabel+',';
        }
      }
      return showtag;
    },
    containsKeyword(content,keyword) {
      return content.includes(keyword);
    },
    showJK(title,teacherId) {
      this.queryParamsJK.version = title;
      this.openJK = true;
      this.titleJK = "上传句块信息";
      this.getListJK();
      this.formUpload.id = teacherId;
    },
    sortJKChange(column) {
      this.loading = true;
      if (column.prop === 'version') {
        this.queryParams.order = 'version';
      }else if (column.prop === 'amount') {
        this.queryParams.order = 'amount';
      }else if (column.prop === 'materialName') {
        this.queryParams.order = 'material_name';
      }else if (column.prop === 'materialKey') {
        this.queryParams.order = 'material_key';
      }
      if (column.order === 'ascending') {
        this.queryParams.orderType = 'asc';
      } else if (column.order === 'descending') {
        this.queryParams.orderType = 'desc';
      }
      listInfo(this.queryParams).then(response => {
        this.infoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询课程教师列表 */
    getList() {
      this.loading = true;
      listTeacher(this.queryParams).then(response => {
        this.teacherList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getListJK() {
      this.loadingJK = true;
      this.jkList = [];
      listInfojk(this.queryParamsJK).then(response => {
        this.jkList = response.rows;
        this.totalJK = response.total;
        this.loadingJK = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancelJK() {
      this.openJK = false;
      this.resetJK();
    },
    cancelJKD() {
      this.openJKD = false;
      this.resetJK();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        createTime: null,
        updateTime: null,
        teacherName: null,
        teacherIntroduction: null,
        teacherHeadimgurl: null
      };
      this.resetForm("form");
    },
    resetJK() {
      this.formJK = {
        id: null,
        grade: null,
        subject: null,
        age: null,
        semester: null,
        materialName: null,
        version: null,
        region: null,
        isFree: null,
        amount: null,
        userId: null,
        createTime: null
      };
      this.resetForm("formJK");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加课程教师";
    },
    handleAddJK() {
      this.formJKD = {};
      this.resetJK();
      this.openJKD = true;
      this.titleJKD = "添加句块信息";
      this.formJKD.version = this.queryParamsJK.version;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const teacherId = row.id || this.ids      
      getTeacher(teacherId).then(response => {
        this.form = response.data;
        if (this.form.teacherTypes) {
          let labelAry = this.form.teacherTypes.split(',');
          let labelIdAry = new Array();
          labelAry.forEach(item => {
            labelIdAry.push(item+'');
          })
          this.form.teacherType = labelIdAry;
        }
        if (this.form.teacherTags) {
          let labelAry = this.form.teacherTags.split(',');
          let labelIdAry = new Array();
          labelAry.forEach(item => {
            labelIdAry.push(item+'');
          })
          this.form.teacherTag = labelIdAry;
        }
        this.open = true;
        this.title = "修改课程教师";
      });
    },
    handleUpdateJKD(row) {
      this.resetJK();
      const id = row.id || this.ids
      getInfojk(id).then(response => {
        this.formJKD = response.data;
        this.formJKD.grade = this.formJKD.grade+'';
        this.formJKD.subject = this.formJKD.subject+'';
        this.formJKD.semester = this.formJKD.semester+'';
        this.formJKD.isFree = this.formJKD.isFree+'';
        this.openJKD = true;
        this.titleJKd = "修改句块信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.teacherTypes&&this.form.teacherTypes.length>0) {
            this.form.teacherType = this.form.teacherTypes.join(',');
          }else {
            this.form.teacherType = null;
          }
          if (this.form.teacherTags&&this.form.teacherTags.length>0) {
            this.form.teacherTag = this.form.teacherTags.join(',');
          }else {
            this.form.teacherTag = null;
          }
          if (this.form.id != null) {
            updateTeacher(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addTeacher(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    submitFormJKD() {
      if (this.formJKD.materialName == null||this.formJKD.materialName == '') {
          this.$modal.msgError("请输入句块内容");
          return;
      }
      if (this.formJKD.materialKey == null||this.formJKD.materialKey == '') {
          this.$modal.msgError("请输入句块关键字");
          return;
      }
      if (this.formJKD.id != null) {
          updateInfojk(this.formJKD).then(response => {
              this.$modal.msgSuccess("修改句块成功");
              this.openJKD = false;
              this.getListJK();
          });
      } else {
          addInfojk(this.formJKD).then(response => {
              this.$modal.msgSuccess("新增句块成功");
              this.openJKD = false;
              this.getListJK();
          });
      }
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const teacherIds = row.id || this.ids;
      this.$confirm('是否确认删除课程教师编号为"' + teacherIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delTeacher(teacherIds);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
    },
    handleDeleteJKD(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除句块信息编号为"' + ids + '"的数据项？').then(function() {
        return delInfojk(ids);
      }).then(() => {
        this.getListjk();
        this.$modal.msgSuccess("删除句块成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有课程教师数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportTeacher(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "句块信息导入";
      this.upload.open = true;
    },
    changeUpdateSupport(value) {
      this.upload.updateSupport = value;
    },
    /** 下载模板操作 */
    importTemplate() {
      downLoadZip('/system/infojk/importTemplate/teacher/'+this.formUpload.id, "句块信息导入模板");
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      if (this.formUpload.id.length<=0) {
        this.msgInfo("请选中导入模板的教师");
        return;
      }else {
        this.$refs.upload.submit();
      }
    }
  }
};
</script>
<style scoped>
.sketch_content {
  overflow: auto;
  height: 750px;
  border-top: 1px solid #eff1f4;
  border-bottom: 1px solid #eff1f4;
  padding: 0px 30px 11px 27px;
}
.sketch_content::-webkit-scrollbar {
  width: 3px;
}
.sketch_content::-webkit-scrollbar-thumb {
  background: #8798AF;
  border-radius: 2px;
}
.sketch_content::-webkit-scrollbar-track {
  background: transparent;
}
</style>